/**
 * 
 */
package connectorTests;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import connectors.Data;

/**
 * @author Lucas 'Mezmor' Pfister
 *
 */
public class DataTests {

	Data data = new Data();
	List<String> arrayData;
	String stringData;
	
	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testSingleString(){
		arrayData = new ArrayList<String>();
		arrayData.add("a1,b3");
		
		stringData = data.getString(arrayData);
		
		assertEquals("a1,b3", stringData);
	}
	
	@Test
	public void testMultiString(){
		arrayData = new ArrayList<String>();
		arrayData.add("a1,b3");
		arrayData.add("a2,b4");
		
		stringData = data.getString(arrayData);
		assertEquals("a1,b3;a2,b4", stringData);
		assertTrue(stringData.equals("a1,b3;a2,b4"));
	}
	
	@Test
	public void testSingleArray(){
		stringData = "a1,b3";
		
		arrayData = data.getArray(stringData);
		assertEquals(1, arrayData.size());
		assertEquals("a1,b3", arrayData.get(0));
	}
	
	@Test
	public void testMultiArray(){
		stringData = "a1,b3;a2,b4";
		
		arrayData = data.getArray(stringData);
		
		assertEquals(2, arrayData.size());
		assertEquals("a1,b3", arrayData.get(0));
		assertEquals("a2,b4", arrayData.get(1));
	}
	
}